<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<sec:authentication property="principal" var="currentPrincipal" scope="page"/>

<div class="modal-dialog ms-modal-dialog">
  <div class="modal-content">

    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">
        <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
      </button>
      <h4 class="modal-title">充值记录&nbsp;-&nbsp;导出</h4>
    </div>

    <form class="form-horizontal ms-form form-personal-info" method="POST"
          action="${ctx.host}/withdraw-records/export">

      <input type="hidden" name="filter" value="true"/>

      <div class="modal-body">

        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">申请开始时间：</label>
          <div class="col-xs-8">
            <input type="text" multiple class="datetime form-control" name="beginCreateTime"></input>
          </div>
        </div>


        <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">申请结束时间：</label>
          <div class="col-xs-8">
            <input multiple class="datetime form-control" name="endCreateTime"></input>
          </div>
        </div>

        <%--提现成功时显示--%>
        <c:if test="${true}">

          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3">打款开始时间：</label>
            <div class="col-xs-8">
              <input multiple class="datetime form-control" name="beginPaidTime"></input>
            </div>
          </div>


          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3">打款结束时间：</label>
            <div class="col-xs-8">
              <input multiple class="datetime form-control" name="endPaidTime"></input>
            </div>
          </div>


          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3">申请人：</label>
            <div class="col-xs-8">
              <select multiple class="select2 form-control" name="agents">
                <c:forEach items="${agents}" var="a">
                  <option value="${a.id}">${a.name} - ${a.company.name}</option>
                </c:forEach>
              </select>
            </div>
          </div>

        </c:if>

      </div>

      <div class="modal-footer ms-modal-footer">
        <button type="submit" class="btn ms-btn btn-primary">确定</button>
        <button type="button" class="btn ms-btn ms-btn-gary"
                data-dismiss="modal">取消
        </button>
      </div>

    </form>

  </div>
</div>

<script src="https://cdn.bootcss.com/jquery-dateFormat/1.0/jquery.dateFormat.js"></script>

<script type="text/javascript">

    $('select').select2({
      placeholder: '请选择',
      minimumResultsForSearch: 5,
      allowClear: true,
    });

    var options = {
      format: 'yyyy-mm-dd hh:ii',
      autoclose: true,
      language: 'zh-CN',
      todayBtn: 'linked',
      todayHighlight: true,
      pickerPosition: 'bottom-right',
      minView: 'hour',
      minTime: false
    };

    var endCreateTimePicker = $('.datetime[name="endCreateTime"]').datetimepicker(options);

    var beginCreateTimePicker = $('.datetime[name="beginCreateTime"]').datetimepicker(options).on("changeDate", function (e) {
      endCreateTimePicker.datetimepicker('setStartDate', $.format.date(e.date, "yyyy-MM-dd HH:mm:ss"))
    });

    var endPaidTimePicker = $('.datetime[name="endPaidTime"]').datetimepicker(options);

    var beginPaidTimePicker = $('.datetime[name="beginPaidTime"]').datetimepicker(options).on("changeDate", function (e) {
      endPaidTimePicker.datetimepicker('setStartDate', $.format.date(e.date, "yyyy-MM-dd HH:mm:ss"))
    });



</script>